﻿using System;
using System.Diagnostics.CodeAnalysis;

namespace CmdTailCmd
{
    //public class CmdTailSettingsAttribute : Attribute
    //{
    //    public bool IgnoreUnknownSettings   {get; set;}
    //    public bool CaseSensitive           {get; set;}
    //    public bool AllowSubstringSettings  {get; set;}
    //    public CmdTailSettingsAttribute()
    //    {
    //        IgnoreUnknownSettings  = true;
    //        CaseSensitive          = false;
    //        AllowSubstringSettings = true;
    //    }
    //}

    /// <summary>
    /// Attributes for an individual setting accepting on the command line
    /// </summary>
    [AttributeUsage(AttributeTargets.Field)]
    public sealed class CmdTailSettingAttribute : Attribute
    {
        /// <summary>
        /// Whether the name of the setting is case sensitive
        /// </summary>
        public bool     NameCaseSensitive    {get; set;}
        
        /// <summary>
        /// Whether the value of the setting must be types with exact case
        /// Only meaningful on an enumeration type field
        /// </summary>
        public bool     ValueCaseSensitive   {get; set;}
        
        /// <summary>
        /// Whether the name of the setting can be shortened to an unambiguous initial substring
        /// </summary>
        public bool     NameAllowSubstring   {get; set;}
        
        /// <summary>
        /// Whether the value of the setting can be shortened to an unambiguous initial substring
        /// Only meaningful on an enumeration type field
        /// </summary>
        public bool     ValueAllowSubstring  {get; set;}
        
        /// <summary>
        /// An array of alternate names allowed for the setting
        /// </summary>
        [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Justification="Attributes have no better choice than property arrays")]
        public string[] AlternateNames       {get; set;}

        /// <summary>
        /// If true, and if this value hasn't been set by name, the first undecorated token is assigned to this value
        /// </summary>
        public bool     DefaultArgument     {get; set;}

        /// <summary>
        /// Constructs a CmdTailSetting attribute
        /// </summary>
        public CmdTailSettingAttribute()
        {
            NameCaseSensitive    = false;
            ValueCaseSensitive   = false;
            NameAllowSubstring   = true;
            ValueAllowSubstring  = true;
            AlternateNames       = null;
            DefaultArgument      = false;
        }
    }
}
